package com.sqx.modules.taking.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.orders.entity.Orders;
import com.sqx.modules.taking.entity.Game;
import com.sqx.modules.taking.entity.OrderTaking;
import com.sqx.modules.taking.response.MyReleaseResponse;
import com.sqx.modules.taking.response.OrderTakingResponse;
import com.sqx.modules.taking.response.TakingDetailsResponse;
import com.sqx.modules.taking.response.TakingResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Mapper
public interface OrderTakingDao extends BaseMapper<OrderTaking> {
    IPage<OrderTakingResponse> queryTaking(@Param("iPage") IPage iPage, @Param("city") String city, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("like") String like, @Param("condition") Integer condition, @Param("bannerid") Long bannerid, @Param("isRecommend") Long isRecommend, @Param("id") String id, @Param("sex") Long sex, @Param("by") String by, @Param("classify") Integer classify, @Param("salesNum") String salesNum, Integer isVip);

    List<OrderTakingResponse> queryLowTaking(@Param("city") String city, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("like") String like, @Param("condition") Integer condition, @Param("bannerid") Long bannerid, @Param("isRecommend") Long isRecommend, @Param("id") String id, @Param("sex") Long sex, @Param("by") String by, @Param("classify") Integer classify, @Param("salesNum") String salesNum, Integer isVip);

    IPage<OrderTakingResponse> queryLowTakings(Page<OrderTakingResponse> pages, @Param("city") String city, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("like") String like, @Param("condition") Integer condition, @Param("bannerid") Long bannerid, @Param("isRecommend") Long isRecommend, @Param("id") String id, @Param("sex") Long sex, @Param("by") String by, @Param("classify") Integer classify, @Param("salesNum") String salesNum, Integer isVip);

    TakingDetailsResponse queryTakingDetails(@Param("id") Long id,@Param("longitude") String longitude,@Param("latitude") String latitude);

    IPage<MyReleaseResponse> selectMyRelease(Page<MyReleaseResponse> page, @Param("userId") Long userId, @Param("status") String status);

    IPage<TakingResponse> queryAllOrderTaking(Page<TakingResponse> page,@Param("city") String city, @Param("arrayList") ArrayList<Long> arrayList,
                                              @Param("status") Long status, @Param("userName") String userName, @Param("userId") Long userId,
                                              @Param("classify") Integer classify,@Param("isRecommend")Integer isRecommend,@Param("myLevel") String myLevel);

    Integer countGoodsByCreateTime(@Param("time")String time,@Param("flag")Integer flag);

    BigDecimal sumGoodsByCreateTime(@Param("time")String time,@Param("flag")Integer flag);

    Integer selectOrderTakingCountByUserId(Long userId,Integer status);

    int updateTakingStatusByUserId(Long userId);

    int getOrderByStatus(@Param("userId") Long userId, @Param("state") int state, String startTime, String endTime);

    int getEvaluateOrder(@Param("userId") Long userId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    Double getEvaluateOrderScore(@Param("userId") Long userId, @Param("startTime") String startTime, @Param("endTime") String endTime);


    BigDecimal getAllProfit(@Param("userId") Long userId, String startTime, String endTime);

    IPage<Orders> selectNowDayOrders(@Param("pages") Page<Orders> pages, @Param("userId") Long userId);

    IPage<OrderTaking> getOrderTakingListByGameId(@Param("pages") Page<OrderTaking> pages, @Param("arrayList") ArrayList<Long> arrayList, @Param("longitude") String longitude, @Param("latitude") String latitude, @Param("condition") Integer condition, @Param("salesNum") String salesNum, @Param("by") String by, String city, Integer isVip);

    /**
     * 查询二级分类排序
     * @return
     */
    List<Game> queryEjGameSort();
}
